<%@page import="com.is.control.AttendanceDetailControl"%>
<%@page import="com.is.control.ParamClassControl"%>
<%@page import="com.is.model.ParamStuyear"%>
<%@page import="com.is.control.ParamStuyearControl"%>
<%@page import="com.is.control.CourseClassControl"%>
<%@page import="com.is.model.CourseClass"%>
<%@page import="java.util.List"%>
<%@page import="com.is.control.StudentControl"%>
<%@page import="com.is.model.Student"%>
<%@page import="com.is.util.ParamUtil"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.is.util.DesData"%>
<%@page import="com.is.control.ParamCourseControl"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../resources/css/user_info.css" />
<style type="text/css">
	#caption{height:30px; line-height:30px; text-align:left;}
	table thead tr th{background:#7BC671;}
</style>
<title>个人出勤情况</title>
</head>
<body>
 <div id="add_info">
 <%
         // 单个学生所有课程出席情况
         DesData des = new DesData();
         String stu=ParamUtil.getString(request,"stuId");
         int stuId = Integer.parseInt(des.decrypt(stu));
         Student cs = StudentControl.getStudent(stuId);
         int classId = Integer.parseInt(cs.getClassId());
         int stuyear = ParamUtil.getInt(request,"stuyear",ParamStuyearControl.getCurrentStuyearId());
         List<CourseClass> ccs = CourseClassControl.getAllCourseClassIdByClassIdAndStuyear(classId,stuyear);
         
 %>

 <form action="allCoursesOneStu.jsp" method="post">
 <table>
 <caption id="caption"> <%=cs.getChineseName() %>的出勤情况：</caption>
 <tr>
 	<td>
 		<select name="stuyear">
		 <%
		         List<ParamStuyear> years = ParamStuyearControl.getAllStuyear();
		         for(ParamStuyear ps:years){
		 %>
		 <option value="<%=ps.getId() %>"><%=ps.getStuyear() %></option>
		 <%} %>
		 </select>
 	</td>
 	<td>
 		 <input type="hidden" value="<%=stu %>" name=stuId/>
		 <input type="submit" value="确认" />
 	</td>
 </tr>
 </table>
 </form>
 <form>
 <table>
 <thead>
 	 <tr>
		 <th>课程</th>
		 <th>迟到</th>
		 <th>缺勤</th>
		 <th>病假</th>
		 <th>事假</th>
		 <th>折为总出勤数</th>
	 </tr>
 </thead>
<tbody>
 <%
         for(CourseClass cc:ccs){
        	 int chidao = AttendanceDetailControl.getCount(1,stuId,cc.getId()+"",ParamStuyearControl.getCurrentStuyearId(),"","");
		     int queqin = AttendanceDetailControl.getCount(2,stuId,cc.getId()+"",ParamStuyearControl.getCurrentStuyearId(),"","");
			 int bingjia = AttendanceDetailControl.getCount(3,stuId,cc.getId()+"",ParamStuyearControl.getCurrentStuyearId(),"","");
			 int shijia = AttendanceDetailControl.getCount(4,stuId,cc.getId()+"",ParamStuyearControl.getCurrentStuyearId(),"","");
		     float total= (float)chidao/3+(float)bingjia/2+shijia+queqin; 
 %>
 <tr>
	 <td><%=ParamCourseControl.getCourseById(cc.getCourseId()).getCourseName()  %></td>
	 <td><%=chidao %></td>
	 <td><%=queqin %></td>
	 <td><%=bingjia %></td>
	 <td><%=shijia %></td>
	 <td><%=total %></td>
	 </tr>
	 <%} %>
 </tbody>
 </table>
 </form>
 </div>
</body>
</html>